﻿using System;
using System.Collections.Generic;
using System.Text;

namespace personalplaner.core.errorhandling
{
    public class UserException : Exception
    {
		Handler _handler;
		internal Handler Handler
		{
			get
			{
				if (_handler == null)
					_handler = new Handler();
				return _handler;
			}
		}

		public UserException()
		{
			Handler.LoggError(base.Message);
		}

    	public UserException(string message)
            : base(message)
        {
			Handler.LoggError(base.Message);
        }

        public UserException(string message, Exception inner)
            : base(message, inner)
        {
			Handler.LoggError("Unhandled exception", base.Source, base.Data.ToString());
        }

		//public UserException(string message, bool generateMessageBox)
		//    : base(message)
		//{
		//    Handler.LoggError("Unhandled exception", base.Source, base.Message);

		//    //if (generateMessageBox)
		//    //    Util.ErrorHandler.ShowError(message);
		//}
    }
}
